﻿//using System;
//using System.Collections.Generic;
//using System.Text;
//using System.Net;
//using HttpLibrary;
//using HtmlParsingLibrary;
//using System.Threading;
//using StockGeneral;
//using System.Data.SqlClient;


//namespace IciciDirect
//{
//    public partial class IciciDirectBroker
//    {
//        ////////////////////////////////////
//        //////      STOCK STATE      //////
//        //////////////////////////////////    


//        public BrokerErrorCode RefreshEquityStockStateToday(IBroker broker, EquityStockInformation stockInfo)
//        {
//            DateTime EarliestValidMarketOpenDate = GeneralUtils.GetMarketCurrentDate();
//            return EquityRefreshStockState(broker, EarliestValidMarketOpenDate, EarliestValidMarketOpenDate, stockInfo);
//        }

//        public BrokerErrorCode EquityRefreshStockState(
//            IBroker broker,
//            DateTime fromDate,
//            DateTime toDate,
//            EquityStockInformation stockInfo)
//        {
//            BrokerErrorCode errorCode = BrokerErrorCode.Unknown;

//            if (stockInfo == null)
//            {
//                return BrokerErrorCode.InValidArg;
//            }
//            Dictionary<string, EquityOrderBookStockElement> orders = new Dictionary<string, EquityOrderBookStockElement>();
//            Dictionary<string, EquityTradeBookStockElement> trades = new Dictionary<string, EquityTradeBookStockElement>();

//            // Get stock filtered Order book
//            errorCode = broker.GetEquityOrderBook(fromDate, toDate, false, true, stockInfo.StockCode, out orders);

//            if (errorCode == BrokerErrorCode.Success)
//            {
//                // Get stock filtered Trade book
//                errorCode = broker.GetEquityTradeBook(broker, fromDate, toDate, false, stockInfo.StockCode, out trades);
//            }

//            if (errorCode == BrokerErrorCode.Success)
//            {
//                // Call stock refresh method to update its state
//                stockInfo.RefreshState(orders, trades);
//            }

//            return errorCode;
//        }


//    }

//}